package com.itheima.array;

import java.util.Scanner;

public class DemoArrayTest {
    public static void main(String[] args) {
        Scanner sc= new Scanner(System.in);
        int[] arr = new int[]{12, 213, 23, 42, 43, 56, 654};
        System.out.println("请输入您要找的数:");
        int num = sc.nextInt();
        int index = -1;
        for (int i = 0; i < arr.length; i++) {
            if (arr[i] == num) {
                index = i;
                break;
            }
        }
        System.out.println("在索引" + index);
    }

}
